home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / lib / tk / listbox.tcl < prev    next >
Text File  |  1995-07-21  |  2KB  |  41 lines

  1. # listbox.tcl --
  2. #
  3. # This file contains Tcl procedures used to manage Tk listboxes.
  4. #
  5. # $Header: /user6/ouster/wish/library/RCS/listbox.tcl,v 1.3 93/07/01 13:42:05 ouster Exp $ SPRITE (Berkeley)
  6. #
  7. # Copyright (c) 1992-1993 The Regents of the University of California.
  8. # All rights reserved.
  9. #
  10. # Permission is hereby granted, without written agreement and without
  11. # license or royalty fees, to use, copy, modify, and distribute this
  12. # software and its documentation for any purpose, provided that the
  13. # above copyright notice and the following two paragraphs appear in
  14. # all copies of this software.
  15. #
  16. # IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  17. # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  18. # OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  19. # CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  20. #
  21. # THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  22. # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  23. # AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  24. # ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  25. # PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  26. #
  27.  
  28. # The procedure below may be invoked to change the behavior of
  29. # listboxes so that only a single item may be selected at once.
  30. # The arguments give one or more windows whose behavior should
  31. # be changed;  if one of the arguments is "Listbox" then the default
  32. # behavior is changed for all listboxes.
  33.  
  34. proc tk_listboxSingleSelect args {
  35.     foreach w $args {
  36.     bind $w <B1-Motion> {%W select from [%W nearest %y]} 
  37.     bind $w <Shift-1> {%W select from [%W nearest %y]}
  38.     bind $w <Shift-B1-Motion> {%W select from [%W nearest %y]}
  39.     }
  40. }
  41.